<?php

/**
 *  @FileComment            [购物车内容的数据库存储模型]
 *  @ProjectName             项目名称：shopFrame
 *  @FileName                   文件名称：ShopCartModel.class.php
 *  @Author                       yuerengui <596580041@qq.com>
 *  @Date                          2014-10-20 10:39:14
 *  *
 */
class ShopCartModel extends Model {

        public $table = 'shopcart';

        public function get_one_data($uid) {
                return $this->where(array('user_uid' => $uid))->find();
        }

        public function add_data($shop = NULL) {
                $data = array(
                    'getAllData' => serialize($shop),
                    'user_uid' => session('uid')
                );
                return $this->add($data);
        }

        public function update_data($uid, $data) {
                $data = array(
                    'getAllData' => serialize($data)
                );
                return $this->where(array('user_uid' => $uid))->update($data);
        }

}
